<template>
  <div class="login-panel">
    <h2>欢迎登录</h2>
    <el-card>
      <login-account ref="accountRef" />
    </el-card>

    <div class="account-control">
      <el-checkbox v-model="isKeepPassword">记住密码</el-checkbox>
      <el-link type="primary">忘记密码</el-link>
    </div>
    <el-button type="primary" class="login-btn" @click="handleLoginBtn"
      >立即登录</el-button
    >
  </div>
  <!-- <div>
    <video
      style="p"
      :style="fixStyle"
      autoplay
      loop
      muted
      class="fillWidth"
      v-on:canplay="canplay"
    >
      <source src="@/assets/sea.mp4" type="video/mp4" />
      浏览器不支持 video 标签，建议升级浏览器。
    </video>
  </div> -->
</template>

<script lang="ts">
import { defineComponent, reactive, ref } from 'vue'
import { rules } from '../config/account-config'
import LoginAccount from './login-account.vue'
export default defineComponent({
  components: {
    LoginAccount,
  },
  setup() {
    const isKeepPassword = ref(true)

    const accountRef = ref<InstanceType<typeof LoginAccount>>()

    //判断账号密码是否满足，自己传入的rules

    const handleLoginBtn = () => {
      accountRef.value?.loginAction(isKeepPassword.value)
    }

    return {
      accountRef,
      rules,
      isKeepPassword,
      handleLoginBtn,
    }
  },
})
</script>

<style lang="less" scoped>
.login-panel {
  text-align: center;
  color: red;
  width: 320px;
  margin-bottom: 100px;

  .account-control {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
  }
  .login-btn {
    width: 100%;
  }
}
</style>
